<?php

declare(strict_types=1);

namespace app\model\admin;

use app\model\AdminBaseModel;
use think\Model;

/**
 * @mixin \think\Model
 */
class MiniUser extends AdminBaseModel
{
    // 数据表名称
    protected $table = 'mini_user';
    protected $scopeField = true;

    // 可搜索字段
    protected $searchField = [];
    // like
    protected $singleSearchField = ['name', 'nickname'];
    // 可作为条件的字段
    protected $whereField = ['status', 'appid', 'openid', 'mobile', 'pid', 'op_id'];
    // 可做为时间范围查询的字段
    protected $timeField = ['created_at'];

    public function pUser()
    {
        return $this->belongsTo(MiniUser::class, 'pid', 'id');
        // return $this->hasMany(MiniUser::class, 'pid', 'id');
    }
    public function op()
    {
        return $this->belongsTo(SysMember::class, 'op_id', 'id');
    }
}
